package com.teradyne.merlin2.ui.client.activitymappers;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.teradyne.merlin2.ui.client.activities.ActivityAsyncProxy;
import com.teradyne.merlin2.ui.client.activities.OrderMenuActivity;
import com.teradyne.merlin2.ui.client.activities.QuoteMenuActivity;
import com.teradyne.merlin2.ui.client.activities.ServicesMenuActivity;
import com.teradyne.merlin2.ui.client.activities.WorkListMenuActivity;
import com.teradyne.merlin2.ui.client.places.HomePlace;
import com.teradyne.merlin2.ui.client.places.OrderPlace;
import com.teradyne.merlin2.ui.client.places.QuotePlace;
import com.teradyne.merlin2.ui.client.places.ServicesPlace;
import com.teradyne.merlin2.ui.client.places.WorkListPlace;

public class LeftSideActivityMapper implements ActivityMapper {

	private final Provider<ActivityAsyncProxy<OrderMenuActivity>> orderMenuActivityProvider;
	private final Provider<ActivityAsyncProxy<QuoteMenuActivity>> quoteMenuActivityProvider;
	private final Provider<ActivityAsyncProxy<ServicesMenuActivity>> servicesMenuActivityProvider;
	private final Provider<ActivityAsyncProxy<WorkListMenuActivity>> workListMenuActivityProvider;

	@Inject
	public LeftSideActivityMapper(Provider<ActivityAsyncProxy<OrderMenuActivity>> orderMenuActivityProvider, Provider<ActivityAsyncProxy<QuoteMenuActivity>> quoteMenuActivityProvider,
			Provider<ActivityAsyncProxy<ServicesMenuActivity>> servicesMenuActivityProvider, Provider<ActivityAsyncProxy<WorkListMenuActivity>> workListMenuActivityProvider) {
		this.orderMenuActivityProvider = orderMenuActivityProvider;
		this.quoteMenuActivityProvider = quoteMenuActivityProvider;
		this.servicesMenuActivityProvider = servicesMenuActivityProvider;
		this.workListMenuActivityProvider = workListMenuActivityProvider;
	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof HomePlace) {

		} else if (place instanceof OrderPlace) {
			return orderMenuActivityProvider.get();
		} else if (place instanceof QuotePlace) {
			return quoteMenuActivityProvider.get();
		} else if (place instanceof ServicesPlace) {
			return servicesMenuActivityProvider.get();
		} else if (place instanceof WorkListPlace) {
			return workListMenuActivityProvider.get();
		}
		return null;

	}

}